<?php

/*
 * Copyright (c) 2012-2013 Aalto University and University of Helsinki
 * MIT License
 * see LICENSE.txt for more information
 */

class DataObject {
  protected $model;  // Model instance which created this object
  protected $resource; // EasyRdf resource representing this object

  public function __construct($model, $resource) {
    $this->model = $model;
    $this->resource = $resource;
  }
  
  function __get($name) {
    if ($name == 'lang') {
      // get language from locale, same as used by gettext, set by Controller
      $this->lang = substr(getenv("LC_ALL"), 0, 2);
      return $this->lang;
    }
    $trace = debug_backtrace();
    trigger_error(
        'Undefined property via __get(): ' . $name .
        ' in ' . $trace[0]['file'] .
        ' on line ' . $trace[0]['line'],
        E_USER_NOTICE);
    return null;  
  }

}

?>
